{include file="common:meta" /}

<title>配置管理 - 修改配置 - TXCMS_V2</title>
<meta name="keywords" content="">
<meta name="description" content="">
</head>
<body>
<article class="cl pd-20">
    <form action="" method="post" class="form form-horizontal form-change-setting" >
        <input type="hidden" name="id" value="{$id}">
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>修改配置：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <textarea name="setting" class="textarea radius">{$data.setting}</textarea>
            </div>
        </div>
        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <input class="btn btn-primary radius" type="button" id="button" value="&nbsp;&nbsp;确认修改&nbsp;&nbsp;">
            </div>
        </div>
    </form>
</article>

{include file="common:footer" /}
{load href="__STATIC__/admin/lib/jquery.validation/1.14.0/jquery.validate.js"}
{load href="__STATIC__/admin/lib/jquery.validation/1.14.0/validate-methods.js"}
{load href="__STATIC__/admin/lib/jquery.validation/1.14.0/messages_zh.js"}
<script type="text/javascript">
    $(function(){
        $("#form-change-password").validate({
            rules:{
                newpassword:{
                    required:true,
                    minlength:6,
                    maxlength:16
                },
                newpassword2:{
                    required:true,
                    minlength:6,
                    maxlength:16,
                    equalTo: "#newpassword"
                },
            },
            onkeyup:false,
            focusCleanup:true,
            success:"valid",
            submitHandler:function(form){
                $(form).ajaxSubmit();
                var index = parent.layer.getFrameIndex(window.name);
                parent.$('.btn-refresh').click();
                parent.layer.close(index);
            }
        });
    });
    $('#button').click(function () {
        var formData  = $('.form-change-setting').serialize();
        $.ajax({
            url:"{:url('game_list/changeSettingSave')}",
            type:'post',
            data:formData,
            success:function (res) {
                if(res.code === 0 ){
                    //失败
                    layer.msg(res.msg,{icon:2},300);
                    var index = parent.layer.getFrameIndex(window.name);
                    setTimeout(function(){
                        parent.location.reload(); //刷新父级页面
                        parent.layer.close(index);//关闭弹出层
                    }, 2000);
                }else{
                    //成功
                    layer.msg(res.msg,{icon:1},300);
                    var index1 = parent.layer.getFrameIndex(window.name);
                    setTimeout(function(){
                        parent.location.reload();
                        parent.layer.close(index1);//关闭弹出层
                    }, 2000);
                }
            }
        })
    })
</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>